package dev.alm.functioncallchatmodel.controller;

import dev.alm.functioncallchatmodel.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("llm")
public class LLMController {

    @Autowired
    private ChatService chatService;

    @GetMapping("chat")
    public Flux<String> chat(@RequestParam("memoryId") String memoryId, @RequestParam(value = "userMessage", defaultValue = "你是谁？") String userMessage, @RequestParam(value = "length", defaultValue = "1000") int length) {
        return chatService.chat(memoryId, userMessage, length);
    }
}
